// 生产环境配置
const path = require('path');
const BaseWebpackConfig = require('./webpack.base.config');
const { merge } = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const config = merge(BaseWebpackConfig,  {
    entry: {
        index: './src/index.js',
    },
    output: {
        filename: "js/[name].js?[hash]",
        path: path.resolve(__dirname, 'web'),
        chunkFilename: 'js/[name].js?[hash]',
    },
    devServer: {
        contentBase: './web',
    },
    plugins: [
        new HtmlWebpackPlugin({
            inject: 'body',
            filename: 'index.html',
            template: 'index.html',
            chunks:['index'],
            hash: true,
            minify:{
                collapseWhitespace: true,
                removeComments: true,
            }
        })
    ]
});
module.exports = config;
